package com.example.demo.service.impl;

import com.example.demo.entity.BookWithUser;
import com.example.demo.mapper.BookWithUserMapper;
import com.example.demo.service.BookWithUserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class BookWithUserServiceImpl implements BookWithUserService {

    @Resource
    private BookWithUserMapper bookWithUserMapper;

    @Override
    public int insert(BookWithUser bookWithUser) {
        return bookWithUserMapper.insert(bookWithUser);
    }

    @Override
    public int updateRecord(BookWithUser record) {
        return bookWithUserMapper.updateRecord(record);
    }

    @Override
    public int deleteRecord(BookWithUser record) {
        return bookWithUserMapper.deleteRecord(record);
    }

    @Override
    public int prolongRecord(BookWithUser record) {
        return bookWithUserMapper.prolongRecord(record);
    }

    @Override
    public List<BookWithUser> selectPage(int pageNum, int pageSize, String search1, String search2, String search3) {
        int offset = (pageNum - 1) * pageSize;
        return bookWithUserMapper.selectPage(offset, pageSize, search1, search2, search3);
    }

    @Override
    public int selectCount(String search1, String search2, String search3) {
        return bookWithUserMapper.selectCount(search1, search2, search3);
    }
}